import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class Sku {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ nullable: false })
  title: string;

  @Column({ type: 'int', default: 0, nullable: false })
  photoCount: number;

  @Column({ nullable: true })
  page: string;

  @Column({ default: true })
  isDeletable: boolean;

  @Column({
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
    transformer: {
      to: (value: number) => value,
      from: (value: string) => parseFloat(value),
    },
  })
  price: number;
}
